//Copyright 2010 Balazs Keri, Imre Keri
//
//This file is part of FireworksCreator.
//
//FireworksCreator is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//FireworksCreator is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with FireworksCreator.  If not, see <http://www.gnu.org/licenses/>.
//
#ifndef _ID_H
#define _ID_H
//
#include <global.h>
#include <QMetaType>
//
class Id
{
public:
   Id();
   bool is_invalid()const;
   friend bool operator==(const Id &p_id1,const Id &p_id2);
   friend uint qHash(const Id &p_key);
   friend QDataStream &operator<<(QDataStream &p_stream,const Id &id);
   friend QDataStream &operator>>(QDataStream &p_stream,Id &id);
   friend class IdGenerator;
private:
   quint64 value;
   Id(quint64 p_value);
};
Q_DECLARE_METATYPE(Id)
//
inline bool operator==(const Id &p_id1,const Id &p_id2)
{
   return p_id1.value==p_id2.value;
}
inline uint qHash(const Id &p_key)
{
   return qHash(p_key.value);
}
//
#endif
